package day9;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @author oldliu
 * @since 1.0
 */
public class MyClient {
    public static void main(String[] args) {
        try {
            Socket s=new Socket("192.168.1.131",9999);
            InputStream in = s.getInputStream();
            OutputStream out = s.getOutputStream();
            //
            out.write("hello,This is java75".getBytes());
            out.flush();
            s.shutdownOutput();//关闭输出流
            int ch=0;
            while((ch=in.read())!=-1){
                System.out.print((char)ch);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        //s.bind();
    }
}
